

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

//将http导入
import http from './config/config'



const app = createApp(App)
app.config.warnHandler = () => null
//图标使用
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(store).use(router)
 .use(ElementPlus)

//将我们自定义的http挂载到vue上
app.config.globalProperties.$http = http


app.mount('#app')

//路由守卫
// GOOD
// router.beforeEach((to, from, next) => {
     
//   //  if(localStorage.getItem('username')==null){
//   //     router.push('/login')
//   //     next()
//   //  }else{
//   //   next()
//   //  }
  
// })

 router.beforeEach((to,from,next)=>{
    // if(to.path=='/login'){
    //   next()
    // }else{
    //   if(localStorage.getItem('username')==null){
    //     router.push('/login')
       
    //   }
    // }
      next()
    
 })







